<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table id="table0">
    <tr>
        <td>Row 0 Cell 0</td>
        <td>Row 0 Cell 1</td>
    </tr>
</table>

<script>

    var table = document.getElementById('table0');
    var row = table.insertRow(-1);
    var cell,
            text;

    for (var i=0; i<2; i++) {
        cell = row.insertCell(-1);
        text = 'Row ' + row.rowIndex + ' Cell ' + i;
        cell.appendChild(document.createTextNode(text));
    }
</script>
</body>
</html>